package com.htzos.admin.ac.service;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import com.htzos.admin.ac.bean.AcMessageBase;
import com.htzos.admin.ac.dao.AcMessageBaseMapper;
import com.htzos.admin.system.bean.SystemUserBase;
import com.htzos.common.tool.ExtQueryBean;
@Service
@Transactional(rollbackFor = Exception.class)
public class AcMessageBaseService {
    @Autowired
    AcMessageBaseMapper acMessageBaseMapper;
    @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
    public List<AcMessageBase> acMessageBaseList(AcMessageBase acMessageBase, ExtQueryBean extQuery){
       return acMessageBaseMapper.acMessageBaseList(acMessageBase, extQuery);
    }

    @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
    public Integer acMessageBaseTotal(AcMessageBase acMessageBase, ExtQueryBean extQuery){
       return acMessageBaseMapper.acMessageBaseTotal(acMessageBase, extQuery);
    }

    @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
    public int acMessageBaseUpdate(AcMessageBase acMessageBase){
       return acMessageBaseMapper.acMessageBaseUpdate(acMessageBase);
    }

    @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
    public int acMessageBaseInsert(AcMessageBase acMessageBase){
       return acMessageBaseMapper.acMessageBaseInsert(acMessageBase);
    }

    @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
    public int acMessageBaseDelete(AcMessageBase acMessageBase){
       return acMessageBaseMapper.acMessageBaseDelete(acMessageBase);
    }

    @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
    public AcMessageBase acMessageBaseGet(String id){
       return acMessageBaseMapper.acMessageBaseGet(id);
    }
    
    /**
     * 未读消息数量
     *
     * @author 徐德志
     * @time 2016 2016年5月23日 下午5:02:27
     * @parameter 
     * @param user
     */
    @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
	public Integer disreadMessageCount(SystemUserBase user) {
    	
    	Integer count=0;
    	
    	count=acMessageBaseMapper.disreadMessageCount(user);
    	
    	return count;
	}

    /**
     * 已读消息数量
     *
     * @author 徐德志
     * @time 2016 2016年5月23日 下午5:02:42
     * @parameter 
     * @param user
     */
    @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
	public Integer enreadMessageCount(SystemUserBase user) {
    	
    	Integer count=0;
    	
    	count=acMessageBaseMapper.enreadMessageCount(user);
    	
    	return count;
	}

    /**
     * 已阅消息列表
     *
     * @author 徐德志
     * @time 2016 2016年5月24日 上午10:31:17
     * @parameter 
     * @param user
     * @param extQuery
     * @return
     */
    @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
	public List<AcMessageBase> enreadMessageList(SystemUserBase user,
			ExtQueryBean extQuery) {

		List<AcMessageBase> messageList=acMessageBaseMapper.enreadMessageList(user,extQuery);
		
		return messageList;
	}
    
    /**
     * 未阅读消息列表
     *
     * @author 徐德志
     * @time 2016 2016年5月24日 上午10:31:27
     * @parameter 
     * @param user
     * @param extQuery
     * @return
     */
    @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
	public List<AcMessageBase> disreadMessageList(SystemUserBase user,
			ExtQueryBean extQuery) {
    	List<AcMessageBase> messageList=acMessageBaseMapper.disreadMessageList(user,extQuery);
		return messageList;
	}

    /**
     * 查询今日公告消息
     *
     * @author 徐德志
     * @time 2016 2016年5月23日 下午5:04:20
     * @parameter
     */
//    @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
//	public Integer unreadTodayMessage(SystemUserBase user) {
//		
//    	return 0;
//	}
}